package com.aigc.bugaigc.controller;

import com.aigc.bugaigc.entity.Bug;
import com.aigc.bugaigc.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/reports")
public class ReportController {
    @Autowired
    private ReportService reportService;

    @GetMapping("/status/{status}")
    public List<Bug> getBugsByStatus(@PathVariable String status) {
        return reportService.getBugsByStatus(status);
    }

    @GetMapping("/priority/{priority}/count")
    public int getBugCountByPriority(@PathVariable String priority) {
        return reportService.getBugCountByPriority(priority);
    }
}